home *** CD-ROM | disk | FTP | other *** search
- /* net/rom level 4 (transport) protocol implementation
- * Dan Frank, W9NK
- */
-
- #include <stdio.h>
- #include "global.h"
- #include "mbuf.h"
- #include "timer.h"
- #include "ax25.h"
- #include "lapb.h"
- #include "netrom.h"
- #include "nr4.h"
- #include <ctype.h>
-
- void
- nr4input(hdr,bp)
- struct nr4hdr *hdr ;
- struct mbuf *bp ;
- {
- struct nr4hdr rhdr ;
- struct nr3hdr n3hdr ;
- struct mbuf *n3b, *n4b ;
-
- /* For now, just reject connections. We'll maybe get
- * more clever later ...
- */
-
- if (hdr->opcode == NR4OPCONRQ) {
- /* Format a network header - source call will be filled
- * in by nr_route()
- */
- n3hdr.dest = hdr->u.conreq.node ; /* respond to node */
- n3hdr.ttl = Nr_ttl ;
-
- /* Format a transport connect acknowledge header */
- rhdr.opcode = NR4OPCONAK | NR4CHOKE ; /* choke means reject */
- rhdr.u.conack.yourindex = hdr->u.conreq.myindex ;
- rhdr.u.conack.yourid = hdr->u.conreq.myid ;
- rhdr.u.conack.myindex = 0 ;
- rhdr.u.conack.myid = 0 ;
- rhdr.u.conack.window = 0 ;
-
- if ((n3b = htonnr3(&n3hdr)) == NULLBUF) {
- free_p(bp) ;
- return ;
- }
-
- if ((n4b = htonnr4(&rhdr)) == NULLBUF) {
- free_p(n3b) ;
- free_p(bp) ;
- return ;
- }
-
- append(&n3b,n4b) ;
- nr_route(n3b,NULLAX25) ;
- }
-
- free_p(bp) ;
- }
-